home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1030 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: gryphon.phoenix.net!usenet
  2. From: brucew@phoenix.net (Bruce Wedding)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Problem with stringcopy
  5. Date: Thu, 11 Jan 1996 01:51:28 GMT
  6. Organization: BranPaul Systems
  7. Message-ID: <4d1o41$sec@gryphon.phoenix.net>
  8. References: <4clguu$9fs@eagle.novo.dk> <yewvimppjz5.fsf@hyll.idt.unit.no> <4cmafq$bm5@clarknet.clark.net> <4cmi91$irn@newshost.lanl.gov>
  9. NNTP-Posting-Host: dial18.phoenix.net
  10. X-Newsreader: Moe's Newsreader    
  11.  
  12. tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) wrote:
  13.  
  14. >|> >char *Stringcopy(char *source, int startpos, size_t length)
  15. >|> >{
  16. >|> >    char tmpstring[SIZEBIGENOUGH];
  17. >|> >    strncpy((char *)(source+startpos),tmpstring,length);
  18. >|> >    return tmpstring;
  19. >|> >}
  20. >|> 
  21. >but, most importantly, 
  22. >this routine contains one of the very common and absolutely disastrous
  23. >beginner errors! Anyone?
  24.  
  25. Returning a pointer to an automatic.  What do I win :)
  26.  
  27.  
  28. Bruce D. Wedding                        Have Compiler, Will Travel!
  29.               Perspicacious Programming Performed Promptly
  30. Katy, Texas, USA, Planet Earth, Milkyway Galaxy, Known Universe
  31.  
  32.